package cc.wsyw126.java.interview.jingdong;

import java.util.Scanner;

/**
 * Created by Administrator on 2017/9/6.
 */
public class Main2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = Integer.parseInt(scanner.nextLine());
            int count = 0;
            for (int i = 1; i <= n; i++) {
                for (int j = 1; j <= n; j++) {
                    for (int k = 1; k <= n; k++) {
                        for (int l = 1; l <= n; l++) {
                            double pow = Math.pow(i, j);
                            double pow1 = Math.pow(k, l);
                            if (pow == pow1) {
                                count++;
                                System.out.println(i + "^" + j + "=" + k + "^" + l);
                            }
                        }
                    }
                }
            }
            System.out.println(count);
        }
    }

}
